/**
*@Description:NavBar，标题栏
*@Author:nnf
*@Date:2020/09/15 16:48:51
*@todo:
*@param:{String}--title--标题 required
*@param:{String}--rightText--右侧标题
*@useage:<base-nav-bar @leftClick="leftClick" :title="title" />
*/
<template>
  <div class="nav-header">
    <van-nav-bar
      van-icon="#FFFFFF"
      class="header"
      :title="title"
      :right-text="rightText"
      left-arrow
      @click-left="leftClick"
      @click-right="rightClick"
    >
      <template #left>
        <img src="@assetsImgs/back.png" class="back_img"/>
      </template>
    </van-nav-bar>
  </div>
</template>
<script>
import { NavBar } from 'vant';

export default {
  name: 'BaseNavBar',
  components: {
    [NavBar.name]: NavBar,
  },
  props: {
    title: {
      type: String,
      required: true,
    },
    rightText: {
      type: String,
      required: false,
    },
  },
  methods: {
    leftClick() {
      this.$emit('leftClick');
    },
    rightClick() {
      this.$emit('rightClick');
    },
  },
};
</script>

<style lang="less" scoped>
  .nav-header{
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 50;
    .back_img{
      height: 16px;
      width: 10px;
    }
  }
  .header {
    background-color: #009B63;
    height: 44px;
  }
  /deep/.van-nav-bar .van-icon {
    color: #FFFFFF;
  }
  /deep/.van-nav-bar__text{
    color: #FFFFFF;
  }
  /deep/.van-nav-bar__title {
    max-width: 60%;
    height: 24px;
    font-size: 17px;
    font-family: PingFang-SC-Bold, PingFang-SC;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 24px;
    text-align: center;
  }
</style>
